<template>
  <div>
    <CodeCard v-bind="btnDesc">
      <sdn-input-number v-model="num" @change="handleChange" :min="1" :max="10" label="描述文字"></sdn-input-number>
      <template #annotation></template>
    </CodeCard>
  </div>
</template>

<script>


export default {
  components: {
    
  },
  data() {
    return {
      num: 1
    }
  },
  methods: {
    handleChange(value) {
      console.log(value);
    }
  },
  setup() {
    const btnDesc = {
      title: "InputNumber 计数器",
      describe: "仅允许输入标准的数字值，可定义范围",
      codeBlock: `<sdn-input-number v-model="num" @change="handleChange" :min="1" :max="10" label="描述文字"></sdn-input-number>`,
      attrs: [
        {
          "name": "value / v-model",
          "describe": "绑定值",
          "type": "number",
          "emun": "—",
          "default": "0"
        }, {
          "name": "min",
          "describe": "设置计数器允许的最小值",
          "type": "number",
          "emun": "—",
          "default": "-Infinity"
        }, {
          "name": "max",
          "describe": "设置计数器允许的最大值",
          "type": "number",
          "emun": "—",
          "default": "Infinity"
        }, {"name": "step", "describe": "计数器步长", "type": "number", "emun": "—", "default": "1"}, {
          "name": "step-strictly",
          "describe": "是否只能输入 step 的倍数",
          "type": "boolean",
          "emun": "—",
          "default": "FALSE"
        }, {"name": "precision", "describe": "数值精度", "type": "number", "emun": "—", "default": "—"}, {
          "name": "size",
          "describe": "计数器尺寸",
          "type": "string",
          "emun": "large, small",
          "default": "—"
        }, {
          "name": "disabled",
          "describe": "是否禁用计数器",
          "type": "boolean",
          "emun": "—",
          "default": "FALSE"
        }, {
          "name": "controls",
          "describe": "是否使用控制按钮",
          "type": "boolean",
          "emun": "—",
          "default": "TRUE"
        }, {
          "name": "controls-position",
          "describe": "控制按钮位置",
          "type": "string",
          "emun": "right",
          "default": "-"
        }, {"name": "name", "describe": "原生属性", "type": "string", "emun": "—", "default": "—"}, {
          "name": "label",
          "describe": "输入框关联的label文字",
          "type": "string",
          "emun": "—",
          "default": "—"
        }, {"name": "placeholder", "describe": "输入框默认 placeholder", "type": "string", "emun": "-", "default": "-"}],
      methods: [
        {"name": "focus", "describe": "使 input 获取焦点", "params": "-"}, {
          "name": "select",
          "describe": "选中 input 中的文字",
          "params": "—"
        }]
    };
    return {
      btnDesc,
    };
  },
};
</script>

<style scoped>
.demo {
  margin-bottom: 0.1rem;
  max-width: 50%;
}
</style>
